home *** CD-ROM | disk | FTP | other *** search
/ Aminet 34 / Aminet 34 (2000)(Schatztruhe)[!][Dec 1999].iso / Aminet / util / misc / dial.lha / Dial / source / GUI.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-22  |  28.6 KB  |  755 lines

  1. /* /// "includes1"  */
  2. #ifndef MAKE_ID
  3. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  4. #endif
  5.  
  6. /* Libraries */
  7. #include <libraries/mui.h>
  8. #include <libraries/gadtools.h> /* for Barlabel in MenuItem */
  9. #include <exec/memory.h>
  10.  
  11. /* Prototypes */
  12. #include <proto/muimaster.h>
  13. #include <proto/exec.h>
  14. #ifdef __GNUC__
  15. #include <proto/alib.h>
  16. #else
  17. #include <clib/alib_protos.h>
  18. #endif /* __GNUC__ */
  19. /* /// */
  20.  
  21. #include <workbench/icon.h>
  22. #include "GUI.h"
  23. #include "Hook_utility.h"
  24. #include "listhooks.h"
  25.  
  26. extern struct Library *IconBase;
  27.  
  28. struct Hook DsplHook;
  29. struct Hook CmpHook;
  30. struct Hook ConsHook;
  31. struct Hook DesHook;
  32.  
  33. struct DiskObject *dobj = 0;            /* for AppIcon */
  34. char *str=0;                            /* used for string "Arexx Port Name: DIAL.x" in About Win */
  35.  
  36.  
  37. static struct MUI_CustomClass *LeftRightClass=NULL;
  38.  
  39. char *STR_LeftRight[3];                 /* for LeftRightDispatcher, filled in with Locale strings */
  40.  
  41. /* /// "Menu definition"  */
  42.  
  43. static struct NewMenu MenuData1[] =
  44. {
  45.     { NM_TITLE, "Project"       , 0 , 0, 0, (APTR)MEN_PROJECT },
  46.     { NM_ITEM,  "Load Phonebook","l", 0, 0, (APTR)MEN_LOAD },
  47.     { NM_ITEM,  "Save Phonebook","s", 0, 0, (APTR)MEN_SAVE },
  48.     { NM_ITEM,  "About..."      , 0 , 0, 0, (APTR)MEN_ABOUT },
  49.     { NM_ITEM,  "About MUI..."  , 0 , 0, 0, (APTR)MEN_ABOUTMUI },
  50.     { NM_ITEM,  NM_BARLABEL     , 0 , 0, 0, (APTR)0 },
  51.     { NM_ITEM,  "Quit"          ,"q", 0, 0, (APTR)MEN_QUIT },
  52.  
  53.     { NM_TITLE, "Settings"      , 0 , 0, 0, (APTR)MEN_SET },
  54.     { NM_ITEM,  "Dial" , 0 , 0, 0, (APTR)MEN_SETTINGS },
  55.     { NM_ITEM,  "MUI ..."  , 0 , 0, 0, (APTR)MEN_MUISET },
  56.     { NM_ITEM,  "Load" , 0 , 0, 0, (APTR)MEN_LOADSET },
  57.     { NM_ITEM,  "Save" , 0 , 0, 0, (APTR)MEN_SAVESET },
  58.     { NM_ITEM,  "default" , 0 , 0, 0, (APTR)MEN_SETDEFAULT },
  59.  
  60.  
  61.     { NM_END,NULL,0,0,0,(APTR)0 }
  62. };
  63. /* /// */
  64.  
  65.  
  66. /* /// "MUI custom class LeftRightDispatcher"  */
  67.  
  68. struct LeftRightData
  69. {
  70.     char buf[20];
  71. };
  72.  
  73. ULONG LeftRightDispatcher(void)
  74. {
  75.     register struct IClass *cl __asm("a0");
  76.     register Object *obj __asm("a2");
  77.     register Msg msg __asm("a1");
  78.  
  79.     if (msg->MethodID==MUIM_Numeric_Stringify)
  80.     {
  81.         struct LeftRightData *data = INST_DATA(cl,obj);
  82.         struct MUIP_Numeric_Stringify *m = (APTR)msg;
  83.  
  84.         if (m->value<0)
  85.             sprintf(data->buf,"%s %d",STR_LeftRight[0],m->value*-1);
  86.         else if(m->value==0)
  87.             strcpy(data->buf,STR_LeftRight[2]);
  88.         else
  89.         sprintf(data->buf,"%s %d",STR_LeftRight[1],m->value);
  90.  
  91.         return((ULONG)data->buf);
  92.     }
  93.  
  94.     return(DoSuperMethodA(cl,obj,msg));
  95. }
  96. /* /// */
  97.  
  98. /* /// "GetMBString"  */
  99. static char *GetMBString(APTR ref)
  100. {
  101.         char *aux;
  102.  
  103.         aux = GetDialString(ref);
  104.         if (aux[1] == '\0') return(&aux[2]);
  105.         else                return(aux);
  106. }
  107. /* /// */
  108.  
  109. /* /// "CreateApp"  */
  110. struct ObjApp * CreateApp(int StartIconified)
  111. {
  112.         int i;
  113.         struct ObjApp * ObjectApp;
  114.  
  115.         char *BaseName;
  116.         APTR    GROUP_ROOT_0, GR_Dial, GR_Phonebook, GR_PBbuttons, obj_aux0;
  117.         APTR    obj_aux2, obj_aux4, obj_aux5, obj_aux6, GR_AddRem;
  118.         APTR    GR_LoadSave, GR_Prefs, GR_Settings, strip;
  119.         APTR    GROUP_ROOT_1, A_GR_grp_0, A_GR_grp_1;
  120.  
  121.         STR_LeftRight[0]=GetMBString(MSG_Left),
  122.         STR_LeftRight[1]=GetMBString(MSG_Right),
  123.         STR_LeftRight[2]=GetMBString(MSG_Off),
  124.  
  125.         LeftRightClass=MUI_CreateCustomClass(NULL,MUIC_Slider,NULL,sizeof(struct LeftRightData), LeftRightDispatcher);
  126.         if (!LeftRightClass) return NULL;
  127.  
  128.         if (!(ObjectApp = AllocVec(sizeof(struct ObjApp),MEMF_CLEAR)))
  129.                 return(NULL);
  130.  
  131.         ObjectApp->STR_GR_grp_0[0] = GetMBString(MSG_GR_grp_00);
  132.         ObjectApp->STR_GR_grp_0[1] = GetMBString(MSG_GR_grp_01);
  133.         ObjectApp->STR_GR_grp_0[2] = GetMBString(MSG_GR_grp_02);
  134.         ObjectApp->STR_GR_grp_0[3] = NULL;
  135.  
  136.         MenuData1[0].nm_Label=GetMBString(MSG_MEN_PROJECT);
  137.         MenuData1[1].nm_Label=GetMBString(MSG_MEN_LOAD);
  138.         MenuData1[2].nm_Label=GetMBString(MSG_MEN_SAVE);
  139.         MenuData1[3].nm_Label=GetMBString(MSG_MEN_ABOUT);
  140.         MenuData1[4].nm_Label=GetMBString(MSG_MEN_ABOUTMUI);
  141.             /* Barlabel */
  142.         MenuData1[6].nm_Label=GetMBString(MSG_MEN_QUIT);
  143.         MenuData1[7].nm_Label=GetMBString(MSG_MEN_SET);
  144.         MenuData1[8].nm_Label=GetMBString(MSG_MEN_SETTINGS);
  145.         MenuData1[9].nm_Label=GetMBString(MSG_MEN_MUISET);
  146.         MenuData1[10].nm_Label=GetMBString(MSG_MEN_LOADSET);
  147.         MenuData1[11].nm_Label=GetMBString(MSG_MEN_SAVESET);
  148.         MenuData1[12].nm_Label=GetMBString(MSG_MEN_SETDEFAULT);
  149.  
  150.  
  151.             /* --- own --- */
  152.         InstallHook(&DsplHook, list_dsplfunc, NULL);
  153.         InstallHook(&CmpHook, list_cmpfunc, NULL);
  154.         InstallHook(&ConsHook, list_consfunc, NULL);
  155.         InstallHook(&DesHook, list_desfunc, NULL);
  156.             /* ----------- */
  157.  
  158.         ObjectApp->LV_main = ListObject,
  159.                 MUIA_Frame, MUIV_Frame_InputList,
  160.                 MUIA_List_Format, ",",
  161.                 MUIA_List_DisplayHook, &DsplHook,
  162.                 MUIA_List_CompareHook, &CmpHook,
  163.                 MUIA_List_ConstructHook, &ConsHook,
  164.                 MUIA_List_DestructHook, &DesHook,
  165.                 MUIA_List_AutoVisible,TRUE,
  166.                 MUIA_List_Title,TRUE,
  167.         End;
  168.  
  169.         ObjectApp->LV_main = ListviewObject,
  170.                 MUIA_HelpNode, "LV_main",
  171.                 MUIA_Listview_DoubleClick, TRUE,
  172.                 MUIA_Listview_List, ObjectApp->LV_main,
  173.                 MUIA_ShortHelp, GetMBString(MSG_BH_LV_main),
  174.         End;
  175.  
  176.         ObjectApp->BT_Dial = TextObject,
  177.                 ButtonFrame,
  178.                 MUIA_Weight, 50,
  179.                 MUIA_Background, MUII_ButtonBack,
  180.                 MUIA_ControlChar, tolower(GetDialString(MSG_BT_Dial)[0]),
  181.                 MUIA_Text_Contents, GetMBString(MSG_BT_Dial),
  182.                 MUIA_Text_PreParse, "\033c",
  183.                 MUIA_Text_HiChar, GetDialString(MSG_BT_Dial)[0],
  184.                 MUIA_HelpNode, "BT_Dial",
  185.                 MUIA_InputMode, MUIV_InputMode_RelVerify,
  186.                 MUIA_ShortHelp, GetMBString(MSG_BH_BT_Dial),
  187.         End;
  188.  
  189.         ObjectApp->CH_Conceal = ImageObject,
  190.                 ImageButtonFrame,
  191.                 MUIA_InputMode        , MUIV_InputMode_Toggle,
  192.                 MUIA_Image_Spec       , MUII_CheckMark,
  193.                 MUIA_Image_FreeVert   , TRUE,
  194.                 MUIA_Selected         , FALSE,\
  195.                 MUIA_Background       , MUII_ButtonBack,
  196.                 MUIA_ShowSelState     , FALSE,
  197.                 MUIA_ShortHelp, GetMBString(MSG_BH_CH_CONCEAL),
  198.         End;
  199.  
  200.         obj_aux6 = GroupObject,
  201.                 MUIA_Group_Columns, 2,
  202.                 Child, Label2(GetMBString(MSG_CH_CONCEAL)),
  203.                 Child, ObjectApp->CH_Conceal,
  204.         End;
  205.  
  206.         obj_aux5 = GroupObject,
  207.                 MUIA_Group_Columns, 2,
  208.                 Child, ObjectApp->BT_Dial,
  209.                 Child, obj_aux6,
  210.         End;
  211.  
  212.         GR_Dial = GroupObject,
  213.                 MUIA_HelpNode, "GR_Dial",
  214.                 Child, ObjectApp->LV_main,
  215.                 Child, obj_aux5,
  216.         End;
  217.  
  218.         ObjectApp->LV_set = ListObject,
  219.                 MUIA_Frame, MUIV_Frame_InputList,
  220.                 MUIA_List_Format, ",",
  221.                 MUIA_List_DisplayHook, &DsplHook,
  222.                 MUIA_List_CompareHook, &CmpHook,
  223.                 MUIA_List_ConstructHook, &ConsHook,
  224.                 MUIA_List_DestructHook, &DesHook,
  225.                 MUIA_List_Title,TRUE,
  226.                 MUIA_List_DragSortable,TRUE,
  227.                 MUIA_List_AutoVisible,TRUE,
  228.                 MUIA_ShortHelp, GetMBString(MSG_BH_LV_set),
  229.         End;
  230.  
  231.         ObjectApp->LV_set = ListviewObject,
  232.                 MUIA_HelpNode, "LV_set",
  233.                 MUIA_Listview_List, ObjectApp->LV_set,
  234.                 MUIA_Listview_DragType, MUIV_Listview_DragType_Immediate,
  235.         End;
  236.  
  237.         ObjectApp->STR_Name = StringObject,
  238.                 MUIA_Frame, MUIV_Frame_String,
  239.                 MUIA_HelpNode, "STR_Name",
  240.                 MUIA_String_AdvanceOnCR, TRUE,
  241.                 MUIA_ShortHelp, GetMBString(MSG_BH_STR_Name),
  242.         End;
  243.  
  244.         obj_aux0 = GroupObject,
  245.                 MUIA_Group_Columns, 2,
  246.                 Child, Label2(GetMBString(MSG_STR_Name)),
  247.                 Child, ObjectApp->STR_Name,
  248.         End;
  249.  
  250.         ObjectApp->STR_Number = StringObject,
  251.                 MUIA_Frame, MUIV_Frame_String,
  252.                 MUIA_HelpNode, "STR_Number",
  253.                 MUIA_String_Accept, "0123456789*#!/+-()ABCDEFGHIJKLMNOPQRSTUVWXYZ ",
  254.                 MUIA_ShortHelp, GetMBString(MSG_BH_STR_Number),
  255.         End;
  256.  
  257.         obj_aux2 = GroupObject,
  258.                 MUIA_Group_Columns, 2,
  259.                 Child, Label2(GetMBString(MSG_STR_Number)),
  260.                 Child, ObjectApp->STR_Number,
  261.         End;
  262.  
  263.         ObjectApp->BT_Add = TextObject,
  264.                 ButtonFrame,
  265.                 MUIA_Background, MUII_ButtonBack,
  266.                 MUIA_ControlChar, tolower(GetDialString(MSG_BT_Add)[0]),
  267.                 MUIA_Text_Contents, GetMBString(MSG_BT_Add),
  268.                 MUIA_Text_PreParse, "\033c",
  269.                 MUIA_Text_HiChar, GetDialString(MSG_BT_Add)[0],
  270.                 MUIA_HelpNode, "BT_Add",
  271.                 MUIA_InputMode, MUIV_InputMode_RelVerify,
  272.                 MUIA_ShortHelp, GetMBString(MSG_BH_BT_Add),
  273.         End;
  274.  
  275.         ObjectApp->BT_Remove = TextObject,
  276.                 ButtonFrame,
  277.                 MUIA_Background, MUII_ButtonBack,
  278.                 MUIA_ControlChar, tolower(GetDialString(MSG_BT_Remove)[0]),
  279.                 MUIA_Text_Contents, GetMBString(MSG_BT_Remove),
  280.                 MUIA_Text_PreParse, "\033c",
  281.                 MUIA_Text_HiChar, GetDialString(MSG_BT_Remove)[0],
  282.                 MUIA_HelpNode, "BT_Remove",
  283.                 MUIA_InputMode, MUIV_InputMode_RelVerify,
  284.                 MUIA_ShortHelp, GetMBString(MSG_BH_BT_Remove),
  285.         End;
  286.  
  287.         GR_AddRem = GroupObject,
  288.                 MUIA_HelpNode, "GR_AddRem",
  289.                 MUIA_Group_Horiz, TRUE,
  290.                 Child, ObjectApp->BT_Add,
  291.                 Child, ObjectApp->BT_Remove,
  292.         End;
  293.  
  294.         ObjectApp->BT_Sort = TextObject,
  295.                 ButtonFrame,
  296.                 MUIA_Background, MUII_ButtonBack,
  297.                 MUIA_ControlChar, tolower(GetDialString(MSG_BT_Sort)[0]),
  298.                 MUIA_Text_Contents, GetMBString(MSG_BT_Sort),
  299.                 MUIA_Text_PreParse, "\033c",
  300.                 MUIA_Text_HiChar, GetDialString(MSG_BT_Sort)[0],
  301.                 MUIA_HelpNode, "BT_Sort",
  302.                 MUIA_InputMode, MUIV_InputMode_RelVerify,
  303.                 MUIA_ShortHelp, GetMBString(MSG_BH_BT_Sort),
  304.         End;
  305.  
  306.         ObjectApp->BT_Load = TextObject,
  307.                 ButtonFrame,
  308.                 MUIA_Background, MUII_ButtonBack,
  309.                 MUIA_ControlChar, tolower(GetDialString(MSG_BT_Load)[0]),
  310.                 MUIA_Text_Contents, GetMBString(MSG_BT_Load),
  311.                 MUIA_Text_PreParse, "\033c",
  312.                 MUIA_Text_HiChar, GetDialString(MSG_BT_Load)[0],
  313.                 MUIA_HelpNode, "BT_Load",
  314.                 MUIA_InputMode, MUIV_InputMode_RelVerify,
  315.                 MUIA_ShortHelp, GetMBString(MSG_BH_BT_Load),
  316.         End;
  317.  
  318.         ObjectApp->BT_Save = TextObject,
  319.                 ButtonFrame,
  320.                 MUIA_Background, MUII_ButtonBack,
  321.                 MUIA_ControlChar, tolower(GetDialString(MSG_BT_Save)[0]),
  322.                 MUIA_Text_Contents, GetMBString(MSG_BT_Save),
  323.                 MUIA_Text_PreParse, "\033c",
  324.                 MUIA_Text_HiChar, GetDialString(MSG_BT_Save)[0],
  325.                 MUIA_HelpNode, "BT_Save",
  326.                 MUIA_InputMode, MUIV_InputMode_RelVerify,
  327.                 MUIA_ShortHelp, GetMBString(MSG_BH_BT_Save),
  328.         End;
  329.  
  330.         GR_LoadSave = GroupObject,
  331.                 MUIA_HelpNode, "GR_LoadSave",
  332.                 MUIA_Group_Horiz, TRUE,
  333.                 Child, ObjectApp->BT_Load,
  334.                 Child, ObjectApp->BT_Save,
  335.         End;
  336.  
  337.         GR_PBbuttons = GroupObject,
  338.                 MUIA_HelpNode, "GR_PBbuttons",
  339.                 MUIA_Group_SameSize, TRUE,
  340.                 Child, obj_aux0,
  341.                 Child, obj_aux2,
  342.                 Child, GR_AddRem,
  343.                 Child, HSpace(0),
  344.                 Child, ObjectApp->BT_Sort,
  345.                 Child, VSpace(0),
  346.                 Child, GR_LoadSave,
  347.         End;
  348.  
  349.         GR_Phonebook = GroupObject,
  350.                 MUIA_HelpNode, "GR_Phonebook",
  351.                 MUIA_Group_Horiz, TRUE,
  352.                 Child, ObjectApp->LV_set,
  353.                 Child, BalanceObject, End,
  354.                 Child, GR_PBbuttons,
  355.         End;
  356.  
  357.         ObjectApp->SL_Length = SliderObject,
  358.                 MUIA_HelpNode, "SL_Length",
  359.                 MUIA_Frame, MUIV_Frame_Slider,
  360.                 MUIA_Slider_Min, 4,
  361.                 MUIA_Slider_Max, 100,
  362.                 MUIA_Slider_Level, 12,
  363.                 MUIA_Weight,50,
  364.                 MUIA_Numeric_Format,"%ld0 ms",
  365.                 MUIA_ObjectID, 1,
  366.                 MUIA_ShortHelp, GetMBString(MSG_BH_SL_Length),
  367.         End;
  368.  
  369.         ObjectApp->SL_Pause = SliderObject,
  370.                 MUIA_HelpNode, "SL_Pause",
  371.                 MUIA_Frame, MUIV_Frame_Slider,
  372.                 MUIA_Slider_Min, 4,
  373.                 MUIA_Slider_Max, 100,
  374.                 MUIA_Slider_Level, 6,
  375.                 MUIA_Numeric_Format,"%ld0 ms",
  376.                 MUIA_Weight,50,
  377.                 MUIA_ObjectID, 2,
  378.                 MUIA_ShortHelp, GetMBString(MSG_BH_SL_Pause),
  379.         End;
  380.  
  381.         ObjectApp->SL_Wait = SliderObject,
  382.                 MUIA_HelpNode, "SL_Wait",
  383.                 MUIA_Frame, MUIV_Frame_Slider,
  384.                 MUIA_Slider_Min, 10,
  385.                 MUIA_Slider_Max, 200,
  386.                 MUIA_Slider_Level, 60,
  387.                 MUIA_Numeric_Format,"%ld0 ms",
  388.                 MUIA_Weight,50,
  389.                 MUIA_ObjectID, 3,
  390.                 MUIA_ShortHelp, GetMBString(MSG_BH_SL_Wait),
  391.         End;
  392.  
  393.         ObjectApp->CH_system = ImageObject,
  394.                 ImageButtonFrame,
  395.                 MUIA_InputMode        , MUIV_InputMode_Toggle,
  396.                 MUIA_Image_Spec       , MUII_CheckMark,
  397.                 MUIA_Image_FreeVert   , TRUE,
  398.                 MUIA_Selected         , FALSE,\
  399.                 MUIA_Background       , MUII_ButtonBack,
  400.                 MUIA_ShowSelState     , FALSE,
  401.                 MUIA_ObjectID         , 9,
  402.                 MUIA_ShortHelp, GetMBString(MSG_BH_CH_system),
  403.         End;
  404.  
  405.         obj_aux4 = GroupObject,
  406.                 MUIA_Group_Columns, 2,
  407.                 Child, Label(GetMBString(MSG_LA_label_7)),
  408.                 Child, ObjectApp->CH_system,
  409.         End;
  410.  
  411.         ObjectApp->STR_system = StringObject,
  412.                 MUIA_Frame, MUIV_Frame_String,
  413.                 MUIA_HelpNode, "STR_system",
  414.                 MUIA_String_Accept, "0123456789*#!/-() ",
  415.                 MUIA_String_Contents, "0!",
  416.                 MUIA_String_MaxLen, 10,
  417.                 MUIA_ObjectID, 10,
  418.                 MUIA_ShortHelp, GetMBString(MSG_BH_STR_system),
  419.         End;
  420.  
  421.         ObjectApp->STR_DialCode = StringObject,
  422.                 MUIA_Frame, MUIV_Frame_String,
  423.                 MUIA_HelpNode, "STR_DialCode",
  424.                 MUIA_String_Contents, "00",
  425.                 MUIA_String_Accept, "0123456789*#!/-() ",
  426.                 MUIA_Weight,50,
  427.                 MUIA_ObjectID, 5,
  428.                 MUIA_ShortHelp, GetMBString(MSG_BH_STR_DialCode),
  429.         End;
  430.  
  431.         ObjectApp->STR_PA_pbname = StringObject,
  432.                 MUIA_Frame, MUIV_Frame_String,
  433.                 MUIA_String_Contents, "PROGDIR:Phonebook",
  434.                 MUIA_String_MaxLen, 80,
  435.                 MUIA_ObjectID, 6,
  436.                 MUIA_ShortHelp, GetMBString(MSG_BH_STR_PA_pbname),
  437.         End;
  438.  
  439.         ObjectApp->PA_pbname = PopButton(MUII_PopFile);
  440.  
  441.         ObjectApp->PA_pbname = PopaslObject,
  442.                 MUIA_HelpNode, "PA_pbname",
  443.                 MUIA_Popasl_Type, 0,
  444.                 MUIA_Popstring_String, ObjectApp->STR_PA_pbname,
  445.                 MUIA_Popstring_Button, ObjectApp->PA_pbname,
  446.                 MUIA_Weight,50,
  447.         End;
  448.  
  449.         ObjectApp->SL_AudioLR = NewObject(LeftRightClass->mcc_Class,0,
  450.                 MUIA_HelpNode, "SL_AudioLR",
  451.                 MUIA_Frame, MUIV_Frame_Slider,
  452.                 MUIA_Slider_Min, -64,
  453.                 MUIA_Slider_Max, 64,
  454.                 MUIA_Slider_Level, -64,
  455.                 MUIA_ObjectID, 7,
  456.                 MUIA_ShortHelp, GetMBString(MSG_BH_SL_AudioLR),
  457.                 TAG_DONE);
  458.  
  459.         GR_Settings = GroupObject,
  460.                 MUIA_HelpNode, "GR_Settings",
  461.                 MUIA_Group_Columns, 2,
  462.                 Child, Label(GetMBString(MSG_LA_label_5)),
  463.                 Child, ObjectApp->SL_Length,
  464.                 Child, Label(GetMBString(MSG_LA_label_6)),
  465.                 Child, ObjectApp->SL_Pause,
  466.                 Child, Label(GetMBString(MSG_LA_label_10)),
  467.                 Child, ObjectApp->SL_Wait,
  468.                 Child, obj_aux4,
  469.                 Child, ObjectApp->STR_system,
  470.                 Child, Label(GetMBString(MSG_LA_label_8)),
  471.                 Child, ObjectApp->STR_DialCode,
  472.                 Child, Label(GetMBString(MSG_LA_label_9)),
  473.                 Child, ObjectApp->PA_pbname,
  474.                 Child, Label(GetMBString(MSG_Label_AudioLR)),
  475.                 Child, ObjectApp->SL_AudioLR,
  476.         End;
  477.  
  478.         ObjectApp->BT_PrefSave = TextObject,
  479.                 ButtonFrame,
  480.                 MUIA_Background, MUII_ButtonBack,
  481.                 MUIA_ControlChar, tolower(GetDialString(MSG_BT_PrefSave)[0]),
  482.                 MUIA_Text_Contents, GetMBString(MSG_BT_PrefSave),
  483.                 MUIA_Text_PreParse, "\033c",
  484.                 MUIA_Text_HiChar, GetDialString(MSG_BT_PrefSave)[0],
  485.                 MUIA_HelpNode, "BT_PrefSave",
  486.                 MUIA_InputMode, MUIV_InputMode_RelVerify,
  487.                 MUIA_ShortHelp, GetMBString(MSG_BH_BT_PrefSave),
  488.         End;
  489.  
  490.         GR_Prefs = GroupObject,
  491.                 MUIA_HelpNode, "GR_Prefs",
  492.                 Child, VSpace(0),
  493.                 Child, GR_Settings,
  494.                 Child, VSpace(0),
  495.                 Child, ObjectApp->BT_PrefSave,
  496.         End;
  497.  
  498.         ObjectApp->GR_grp_0 = RegisterObject,
  499.                 MUIA_Register_Titles, ObjectApp->STR_GR_grp_0,
  500.                 MUIA_HelpNode, "GR_grp_0",
  501.                 Child, GR_Dial,
  502.                 Child, GR_Phonebook,
  503.                 Child, GR_Prefs,
  504.         End;
  505.  
  506.         GROUP_ROOT_0 = GroupObject,
  507.                 Child, ObjectApp->GR_grp_0,
  508.         End;
  509.  
  510.         ObjectApp->window = WindowObject,
  511.                 MUIA_Window_Title, "Dial v2.0 © 1999 Andreas Tetzl",
  512.                 MUIA_Window_ID, MAKE_ID('D', 'I', 'A', 'L'),
  513.                 MUIA_Window_Menustrip, strip = MUI_MakeObject(MUIO_MenustripNM, MenuData1, 0),
  514.                 WindowContents, GROUP_ROOT_0,
  515.         End;
  516.  
  517.  
  518.             /* About Window */
  519.         ObjectApp->A_image = ImageObject,
  520.                 MUIA_Image_Spec, "5:PROGDIR:Telephone.img",
  521.                 MUIA_Frame, MUIV_Frame_ImageButton,
  522.                 MUIA_Image_FreeHoriz, TRUE,
  523.                 MUIA_Image_FreeVert, TRUE,
  524.                 MUIA_FixWidth, 128,
  525.                 MUIA_FixHeight, 85,
  526.                 MUIA_InputMode, MUIV_InputMode_RelVerify,
  527.         End;
  528.  
  529.         ObjectApp->A_LV_Text = ListObject,
  530.                 MUIA_Frame, MUIV_Frame_ReadList,
  531.                 MUIA_List_AdjustWidth, TRUE,
  532.         End;
  533.         ObjectApp->A_LV_Text = ListviewObject,
  534.                 MUIA_HelpNode, "A_LV_Text",
  535.                 MUIA_Listview_Input, FALSE,
  536.                 MUIA_Listview_List, ObjectApp->A_LV_Text,
  537.           End;
  538.  
  539.         A_GR_grp_0 = GroupObject,
  540.                 MUIA_HelpNode, "A_GR_grp_0",
  541.                 MUIA_Group_Columns, 2,
  542.                 Child, ObjectApp->A_image,
  543.                 Child, ObjectApp->A_LV_Text,
  544.         End;
  545.  
  546.         ObjectApp->A_BT_OK = SimpleButton("OK");
  547.  
  548.         A_GR_grp_1 = GroupObject,
  549.                 MUIA_HelpNode, "A_GR_grp_1",
  550.                 MUIA_Group_Columns, 3,
  551.                 Child, HSpace(0),
  552.                 Child, ObjectApp->A_BT_OK,
  553.                 Child, HSpace(0),
  554.         End;
  555.  
  556.         GROUP_ROOT_1 = GroupObject,
  557.                 Child, A_GR_grp_0,
  558.                 Child, A_GR_grp_1,
  559.         End;
  560.  
  561.         ObjectApp->aboutwin = WindowObject,
  562.                 MUIA_Window_Title, "Dial",
  563.                 MUIA_Window_ID, MAKE_ID('A', 'B', 'O', 'U'),
  564.                 MUIA_Window_SizeGadget, FALSE,
  565.                 WindowContents, GROUP_ROOT_1,
  566.         End;
  567.  
  568.             /* --------------------- */
  569.  
  570.             /* for MUIA_Application_DiskObject */
  571.         if (IconBase)
  572.             dobj = GetDiskObject("PROGDIR:Dial"),
  573.  
  574.         ObjectApp->App = ApplicationObject,
  575.                 MUIA_Application_Author, "Andreas Tetzl",
  576.                 MUIA_Application_Base, "Dial",
  577.                 MUIA_Application_Title, "Dial",
  578.                 MUIA_Application_Version, "$VER: Dial 2.0 (22.9.99)",
  579.                 MUIA_Application_Copyright, "Andreas Tetzl",
  580.                 MUIA_Application_Description, GetMBString(MSG_AppDescription),
  581.                 MUIA_Application_DiskObject, dobj,
  582.                 SubWindow, ObjectApp->window,
  583.         End;
  584.  
  585.         if (!ObjectApp->App)
  586.         {
  587.                 FreeVec(ObjectApp);
  588.                 return(NULL);
  589.         }
  590.  
  591.         DoMethod(ObjectApp->window,
  592.                 MUIM_Window_SetCycleChain, ObjectApp->GR_grp_0,
  593.                 ObjectApp->LV_main,
  594.                 ObjectApp->BT_Dial,
  595.                 ObjectApp->CH_Conceal,
  596.                 ObjectApp->LV_set,
  597.                 ObjectApp->STR_Name,
  598.                 ObjectApp->STR_Number,
  599.                 ObjectApp->BT_Add,
  600.                 ObjectApp->BT_Remove,
  601.                 ObjectApp->BT_Sort,
  602.                 ObjectApp->BT_Load,
  603.                 ObjectApp->BT_Save,
  604.                 ObjectApp->SL_Length,
  605.                 ObjectApp->SL_Pause,
  606.                 ObjectApp->SL_Wait,
  607.                 ObjectApp->CH_system,
  608.                 ObjectApp->STR_system,
  609.                 ObjectApp->STR_DialCode,
  610.                 ObjectApp->PA_pbname,
  611.                 ObjectApp->SL_AudioLR,
  612.                 ObjectApp->BT_PrefSave,
  613.                 0
  614.                 );
  615.  
  616.         DoMethod(ObjectApp->aboutwin,
  617.                 MUIM_Window_SetCycleChain,
  618.                  ObjectApp->A_image,
  619.                  ObjectApp->A_LV_Text,
  620.                  ObjectApp->A_BT_OK,
  621.                 0
  622.                 );                  
  623.  
  624.                     /* --- own --- */
  625.         DoMethod(ObjectApp->window,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
  626.                  ObjectApp->App,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  627.  
  628.         DoMethod(ObjectApp->LV_main,MUIM_Notify,MUIA_Listview_DoubleClick,TRUE,
  629.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_Dial);
  630.  
  631.         DoMethod(ObjectApp->BT_Dial,MUIM_Notify,MUIA_Pressed,FALSE,
  632.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_Dial);
  633.  
  634.         DoMethod(ObjectApp->BT_Add,MUIM_Notify,MUIA_Pressed,FALSE,
  635.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_Add);
  636.  
  637.         DoMethod(ObjectApp->BT_Load,MUIM_Notify,MUIA_Pressed,FALSE,
  638.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_LoadPB);
  639.  
  640.         DoMethod(ObjectApp->BT_Save,MUIM_Notify,MUIA_Pressed,FALSE,
  641.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_SavePB);
  642.  
  643.         DoMethod(ObjectApp->BT_PrefSave,MUIM_Notify,MUIA_Pressed,FALSE,
  644.                  ObjectApp->App,2,MUIM_Application_Save,MUIV_Application_Save_ENVARC);
  645.  
  646.  
  647.         set(ObjectApp->STR_Name, MUIA_String_AttachedList, ObjectApp->LV_set);
  648.         DoMethod(ObjectApp->STR_Name,MUIM_Notify,MUIA_String_Contents,MUIV_EveryTime,
  649.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_Name);
  650.  
  651.         set(ObjectApp->STR_Number, MUIA_String_AttachedList, ObjectApp->LV_set);
  652.         DoMethod(ObjectApp->STR_Number,MUIM_Notify,MUIA_String_Contents,MUIV_EveryTime,
  653.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_Number);
  654.  
  655.         DoMethod(ObjectApp->LV_set,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime,
  656.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_ListClick);
  657.  
  658.             /* remove active entry from list when BT_Remove is pressed */
  659.         DoMethod(ObjectApp->BT_Remove,MUIM_Notify,MUIA_Pressed,FALSE,
  660.                  ObjectApp->LV_set,2,MUIM_List_Remove,MUIV_List_Remove_Active);
  661.  
  662.  
  663.         DoMethod(ObjectApp->BT_Sort,MUIM_Notify,MUIA_Pressed,FALSE,
  664.                  ObjectApp->LV_set,1,MUIM_List_Sort);
  665.  
  666.  
  667.         DoMethod(ObjectApp->BT_Sort,MUIM_Notify,MUIA_Pressed,FALSE,
  668.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_PBchanged);
  669.         DoMethod(ObjectApp->BT_Remove,MUIM_Notify,MUIA_Pressed,FALSE,
  670.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_PBchanged);
  671.         DoMethod(ObjectApp->BT_Add,MUIM_Notify,MUIA_Pressed,FALSE,
  672.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_PBchanged);
  673.  
  674.  
  675.         DoMethod(ObjectApp->GR_grp_0,MUIM_Notify,MUIA_Group_ActivePage,MUIV_Group_ActivePage_First,
  676.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_DialPage);
  677.  
  678.         DoMethod(ObjectApp->CH_system ,MUIM_Notify,MUIA_Selected,TRUE,
  679.                  ObjectApp->STR_system,3,MUIM_Set,MUIA_Disabled,FALSE);
  680.  
  681.         DoMethod(ObjectApp->CH_system ,MUIM_Notify,MUIA_Selected,FALSE,
  682.                  ObjectApp->STR_system,3,MUIM_Set,MUIA_Disabled,TRUE);
  683.  
  684.         DoMethod(ObjectApp->App,MUIM_Notify,MUIA_Application_MenuAction,MEN_SETTINGS,
  685.                  ObjectApp->GR_grp_0,3,MUIM_Set,MUIA_Group_ActivePage,MUIV_Group_ActivePage_Last);
  686.  
  687.         DoMethod(ObjectApp->App,MUIM_Notify,MUIA_Application_MenuAction,MEN_MUISET,
  688.                  ObjectApp->App,2,MUIM_Application_OpenConfigWindow,0);
  689.  
  690.         DoMethod(ObjectApp->App,MUIM_Notify,MUIA_Application_MenuAction,MEN_LOADSET,
  691.                  ObjectApp->App,2,MUIM_Application_Load,MUIV_Application_Load_ENVARC);
  692.  
  693.         DoMethod(ObjectApp->App,MUIM_Notify,MUIA_Application_MenuAction,MEN_SAVESET,
  694.                  ObjectApp->App,2,MUIM_Application_Save,MUIV_Application_Save_ENVARC);
  695.  
  696.         DoMethod(ObjectApp->App,MUIM_Notify,MUIA_Application_MenuAction,MEN_SETDEFAULT,
  697.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_SETDEFAULT);
  698.  
  699.             /* when the user activates an entry in dial-lisview, activate the same entry in phonebook-list */
  700.         DoMethod(ObjectApp->LV_main,MUIM_Notify,MUIA_List_Active,MUIV_EveryTime,
  701.                  ObjectApp->LV_set,3,MUIM_Set,MUIA_List_Active,MUIV_TriggerValue);
  702.  
  703.  
  704.  
  705.             /* Fill in About Listview */
  706.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "\ec\ebDial v2.0\en", MUIV_List_Insert_Bottom);
  707.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "\ec(22.09.1999)", MUIV_List_Insert_Bottom);
  708.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "", MUIV_List_Insert_Bottom);
  709.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "\ecCopyright © 1999 Andreas Tetzl", MUIV_List_Insert_Bottom);
  710.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "", MUIV_List_Insert_Bottom);
  711.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, GetMBString(MSG_ABOUT1), MUIV_List_Insert_Bottom);
  712.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, GetMBString(MSG_ABOUT2), MUIV_List_Insert_Bottom);
  713.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, GetMBString(MSG_ABOUT3), MUIV_List_Insert_Bottom);
  714.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "", MUIV_List_Insert_Bottom);
  715.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "\ecandreas@tetzl.de",MUIV_List_Insert_Bottom);
  716.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "\echttp://www.tetzl.de",MUIV_List_Insert_Bottom);
  717.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "", MUIV_List_Insert_Bottom);
  718.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "\ec\ebMUI\en Copyright Stefan Stuntz",MUIV_List_Insert_Bottom);
  719.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "\ecAbout Pic & Icon by Jens Borsdorf", MUIV_List_Insert_Bottom);
  720.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, "", MUIV_List_Insert_Bottom);
  721.         get(ObjectApp->App, MUIA_Application_Base, &BaseName);
  722.         str=(char*)malloc(128);
  723.         strcpy(str,"\ecARexx port name: \eb");
  724.         strcat(str,BaseName);
  725.         strcat(str,"\en");
  726.         DoMethod(ObjectApp->A_LV_Text,MUIM_List_InsertSingle, str, MUIV_List_Insert_Bottom);
  727.  
  728.             /* ------- */
  729.             /* send message when user presses image in About window */
  730.         DoMethod(ObjectApp->A_image,MUIM_Notify,MUIA_Pressed,FALSE,
  731.                  ObjectApp->App,2,MUIM_Application_ReturnID,ID_ABOUT_IMAGECLICK);
  732.  
  733.         set(ObjectApp->App,MUIA_Application_Iconified, StartIconified);
  734.  
  735.         set(ObjectApp->window,
  736.                 MUIA_Window_Open, TRUE
  737.                 );
  738.  
  739.  
  740.         return(ObjectApp);
  741. }
  742. /* /// */
  743.  
  744. /* /// "DisposeApp"  */
  745. void DisposeApp(struct ObjApp * ObjectApp)
  746. {
  747.         MUI_DisposeObject(ObjectApp->App);
  748.         FreeVec(ObjectApp);
  749.         if (LeftRightClass) MUI_DeleteCustomClass(LeftRightClass);
  750.         if (dobj) FreeDiskObject(dobj);
  751.         if (str) free(str);
  752. }
  753. /* /// */
  754.  
  755.